package com.cn.leyou.pojo;

import java.util.Date;
import java.util.Map;
import java.util.Set;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

@Data
@Document(indexName = "goods", type = "docs", shards = 1, replicas = 0)
public class Goods {

	@Id
	private Long id;  // spuId

	@Field(type = FieldType.Text, analyzer = "ik_max_word")
	private String all;  // 所有需要被搜索的数据，包含标题，分类，甚至品牌

	@Field(type = FieldType.Keyword, index = false)
	private String subTitle;  // 卖点

	private Long brandId;    // 品牌id
	private Long cid1;       // 1级分类
	private Long cid2;       // 2级分类
	private Long cid3;       // 3级分类
	private Date createTime; // spu创建时间
	private Set<Long> price; // 价格

	@Field(type = FieldType.Keyword, index = false)
	private String skus;     // sku信息的json结构

	private Map<String, Object> specs;  // 可搜索的规格参数，key是参数名，值是参数值
}
